package com.woniuxy.yoga.notice.client;


import com.woniuxy.yoga.commons.core.model.Result;
import com.woniuxy.yoga.notice.model.client.AdminRole;
import com.woniuxy.yoga.notice.model.client.Resource;
import com.woniuxy.yoga.notice.model.client.RoleResource;
import com.woniuxy.yoga.notice.model.dto.adminaccount.AdminByAccountIdDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;


@FeignClient(name = "admin-service",path = "/admin")
public interface AdminClient {

    /**
     * 根据管理员账号ID查询正常账号
     * @param accountId
     * @return
     * @throws Exception
     */
    @GetMapping("/adminAccount/selAdminByAccountId/{accountId}")
    public Result<AdminByAccountIdDTO> selAdminByAccountId(@PathVariable("accountId") Integer accountId);

    /*
     * 根据账号ID查询管理员角色
     * */
    @GetMapping("/adminRole/selectRoleByAccountId/{accountId}")
    public Result<AdminRole> selectRoleByAccountId(@PathVariable("accountId")Integer accountId);

    /*
     * 根据角色ID查资源权限
     * */
    @GetMapping("/roleResource/selectResourceByRole/{roleId}")
    public Result<List<RoleResource>> selectResourceByRole(@PathVariable("roleId") Integer roleId);

    /**
     * 通过资源ID集合查询资源集合
     * @param resourceIds
     * @return
     */
    @PostMapping("/resource/selectResourceByIds")
    public Result<List<Resource>> selectResourceByIds(@RequestBody List<Integer> resourceIds);
}
